/**
 * m站效果图改版
 * 
 * cailiang  2017-11-16
 */

(function (global, factory) {
    factory(global);
})(this, function (web) {
    web.TBSmobile = {
        init: function () {
            this.hideNav()
                .showMenu()
                .hideSlideTip();

        },
        hideNav: function () {
            // 显示隐藏顶部底部
            $('#imgShow').click(function () {
                $('#detail-hd').toggleClass('active');
                $('#detail-info').toggleClass('active');
            });
            return this;
        },
        showMenu: function () {
            // 隐藏显示顶部导航
            $('.nav_bar').click(function () {
                $('.mini-menu').stop().fadeToggle(300);
            });
            // 点击空白处隐藏顶部导航
            $(".mini-menu .close").on("touchstart", function () {
                $(this).parent().fadeOut(300);
            });
            // 返回上一页
            $('.back-prev').click(function () {
                history.go(-1);
            });
            return this;
        },
        hideSlideTip: function () {
            // 获取详情存值cookie
            var cookies = $.cookie('currTime');
            // 判断是否有cookie值
            if (cookies == null) {
                $('.slide-tip').css('display', 'block');
                // 隐藏左右滑动提示
                $('.slide-tip').click(function () {
                    $(this).css('display', 'none');
                    var oldTime = new Date();
                    oldTime.setTime(oldTime.getTime() + (365 * 24 * 60 * 60 * 1000));
                    $.cookie('currTime', 'oldTime', {
                        expires: oldTime,
                        path: "/"
                    });
                });
            };
            return this;
        }
    };
    TBSmobile.init();
});
